package com.boc.langxiang.ui.adapter.adm;

import android.content.Context;
import android.widget.ImageView;

import com.boc.langxiang.R;
import com.boc.langxiang.entity.response.ArticleEntity;
import com.boc.langxiang.entity.response.ArtistArtsEntity;
import com.boc.langxiang.entity.response.PhotoEntity;
import com.boc.langxiang.manager.PicassoImageLoader;
import com.boc.langxiang.util.StringUtil;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * CreateTime: 2016-06-17上午9:23
 * Author: wjkjinke00@126.com
 * Description:
 */
public class ArtistArtsAdapter extends BaseQuickAdapter<ArtistArtsEntity> {

    public ArtistArtsAdapter(Context context, List<ArtistArtsEntity> data) {
        super( R.layout.item_artist_arts, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ArtistArtsEntity item) {
        helper.setText(R.id.title, StringUtil.getValue(item.getTitle()))
                .setText(R.id.price, StringUtil.getValue(item.getPrice()));
        PhotoEntity photo = item.getPhoto();
        if (photo != null) {
            String url = photo.getUrl();
            PicassoImageLoader.getInstance().displayUrlImage(mContext, url
                    , (ImageView) helper.getView(R.id.iamge));
        } else {
            PicassoImageLoader.getInstance().displayUrlImage(mContext, null
                    , (ImageView) helper.getView(R.id.iamge));
        }
    }

}
